<?php
//表情的数据
header('Content-type:text/html;charset=utf-8');
$icon=['icon/1.jpg','icon/1.png','icon/3.jpg'];
define('IS_POST',($_SERVER['REQUEST_METHOD']=='POST')?true:false);
$db = include 'db.php';
//if(!empty($_POST)){
if(IS_POST){
//	print_r($_POST);die;
	$_POST['createtime']=time();
	$db[]=$_POST;

	file_put_contents('db.php', '<?php return '.var_export($db,true).';');

	
}
?>
<?php foreach($db as $d):?>
<li>
	<img src="<?php echo  $d['icon'];?>" style="width:50px">
	<strong><?php echo $d['title']?></strong>
	发表时间：<strong><?php echo date('Y/m/d', $d['createtime'])?></strong>
</li>
<?php endforeach;?>

<form action="" method="post">
	标题： <input type="text" name='title'><br/>
	表情:
	<?php foreach ($icon as $key => $value) :?>
		<label>
		
		<input type="radio" name='icon' checked="checked" value="<?php echo $value;?>"> 
			
		<img src="<?php echo $value;?>" style='width:30px;'/>
	
		</label>
	<?php endforeach;?>
	<br/>
	<input type="submit">
</form>